package com.group3.service.impl;

import com.group3.dao.ListMapper;
import com.group3.pojo.DropGroup;
import com.group3.pojo.DropStudent;
import com.group3.pojo.DropTeacherName;
import com.group3.pojo.Page;
import com.group3.pojo.result.DropLessonNameResult;
import com.group3.pojo.result.LeaveDetailResult;
import com.group3.service.ListService;
import com.group3.utils.Result;
import com.group3.utils.ResultUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @ClassName ListServiceImpl
 * @Author jt-sinlio
 * @Time 2021/6/15 20:45
 **/
@Service
public class ListServiceImpl implements ListService {
    @Resource
    private ListMapper listMapper;


    @Override
    //查找院系（班级表departName字段去重），下拉框使用
    public Result<List<String>> selectDropDepartName() {

        List<String> departNames = listMapper.selectDropDepartName();

        return ResultUtil.success(departNames);
    }

    //查找专业（班级表professionName字段去重），下拉框使用
    @Override
    public Result<List<String>> selectDropProfessionName() {

        List<String> departNames = listMapper.selectProfessionName();

        return ResultUtil.success(departNames);
    }

    //查找年级（班级表grade字段去重），下拉框使用
    @Override
    public Result<List<String>> selectDropGrade() {

        List<String> departNames = listMapper.selectGrade();

        return ResultUtil.success(departNames);
    }

    //查找班级（班级表classId字段去重），下拉框使用
    @Override
    public Result<List<String>> selectDropClassId() {

        List<String> departNames = listMapper.selectClass_id();

        return ResultUtil.success(departNames);
    }




    //------------------------------老师------------------------------------------------------


    //查找课程（课程id、课程名），下拉框使用
    @Override
    public Result<List<DropLessonNameResult>> selectLessons() {
        List<String> departNames = listMapper.selectLessons();

        return ResultUtil.success(departNames);
    }

    //老师-作业管理-下发作业：根据项目名查找小组，下拉框使用
    @Override
    public Result<List<DropGroup>> selectGroup() {
        List<DropGroup> departNames = listMapper.selectGroup();

        return ResultUtil.success(departNames);
    }

    //根据小组id查找学生，下拉框使用
    @Override
    public Result<List<DropStudent>> selectStudentByGroup(Integer key) {
        List<DropStudent> departNames = listMapper.selectStudentByGroup(key);

        return ResultUtil.success(departNames);
    }

    //根据课程id查找学生，下拉框使用
    @Override
    public Result<List<DropStudent>> selectStudentByLesson(Integer key) {
        List<DropStudent> students = listMapper.selectStudentByLesson(key);

        return ResultUtil.success(students);
    }

    //查找责任教师（工号、姓名），下拉框使用
    @Override
    public Result<List<DropTeacherName>> selectTeacherZ() {
        List<DropTeacherName> departNames = listMapper.selectTeacherZ();

        return ResultUtil.success(departNames);
    }

    //查找实训教师（工号、姓名），下拉框使用
    @Override
    public Result<List<DropTeacherName>> selectTeacherS() {
        List<String> departNames = listMapper.selectTeacherS();

        return ResultUtil.success(departNames);
    }

    //查找班主任（工号、姓名），下拉框使用
    @Override
    public Result<List<DropTeacherName>> selectTeacherB() {
        List<String> departNames = listMapper.selectTeacherB();

        return ResultUtil.success(departNames);
    }


    //===========================请假原因详情=============================

    //查看请假原因详情（请假记录id）
//    @Override
//    public Result<LeaveDetailResult> showLeave() {
//        List<String> departNames = listMapper.showLeave();
//
//        return ResultUtil.success(departNames);
//    }

    //===========================门禁打卡记录=============================

    //查询门禁打卡记录
    @Override
    public Result<List<LeaveDetailResult>> selectPunch(Page page) {
        List<String> departNames = listMapper.selectPunch();

        return ResultUtil.success(departNames);
    }

    //===========================根据附件地址删除附件=============================
    @Override
    public Result deleteFile(String fileUrl) {
        List<String> departNames = listMapper.deleteFile();

        return ResultUtil.success(departNames);
    }
}
